package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ly.common.utils.DateUtils;
import com.ly.common.utils.SecurityUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import org.springframework.stereotype.Service;
import com.ly.heart.mapper.SaleCollectionPlanMapper;
import com.ly.heart.domain.SaleCollectionPlanEntity;

import javax.annotation.Resource;

import com.ly.heart.service.ISaleCollectionPlanService;

/**
 * 销售订单修改计划Service业务层处理
 *
 * @author wutao
 * @date 2024-06-30
 */
@Service
public class SaleCollectionPlanServiceImpl extends ServiceImpl<SaleCollectionPlanMapper, SaleCollectionPlanEntity> implements ISaleCollectionPlanService {

    @Resource
    private SaleCollectionPlanMapper saleCollectionPlanMapper;

    /**
     * 查询销售订单修改计划
     *
     * @param id 销售订单修改计划ID
     * @return 销售订单修改计划
     */
    @Override
    public SaleCollectionPlanEntity selectSaleCollectionPlanById ( String id ) {
        return saleCollectionPlanMapper.selectSaleCollectionPlanById ( id );
    }

    /**
     * 查询销售订单修改计划列表
     *
     * @param saleCollectionPlan 销售订单修改计划
     * @return 销售订单修改计划
     */
    @Override
    public List<SaleCollectionPlanEntity> selectSaleCollectionPlanList ( SaleCollectionPlanEntity saleCollectionPlan ) {
        return saleCollectionPlanMapper.selectSaleCollectionPlanList ( saleCollectionPlan );
    }

    /**
     * 新增销售订单修改计划
     *
     * @param saleCollectionPlan 销售订单修改计划
     * @return 结果
     */
    @Override
    public int insertSaleCollectionPlan ( SaleCollectionPlanEntity saleCollectionPlan ) {
        saleCollectionPlan.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        saleCollectionPlan.setCreateBy ( SecurityUtils.getLoginUser ().getUser ().getUserId () );
        saleCollectionPlan.setCreateTime ( DateUtils.getNowDate () );
        return saleCollectionPlanMapper.insertSaleCollectionPlan ( saleCollectionPlan );
    }

    /**
     * 修改销售订单修改计划
     *
     * @param saleCollectionPlan 销售订单修改计划
     * @return 结果
     */
    @Override
    public int updateSaleCollectionPlan ( SaleCollectionPlanEntity saleCollectionPlan ) {
        saleCollectionPlan.setUpdateTime ( DateUtils.getNowDate () );
        return saleCollectionPlanMapper.updateSaleCollectionPlan ( saleCollectionPlan );
    }

    /**
     * 批量删除销售订单修改计划
     *
     * @param ids 需要删除的销售订单修改计划ID
     * @return 结果
     */
    @Override
    public int deleteSaleCollectionPlanByIds ( String[] ids ) {
        return saleCollectionPlanMapper.deleteSaleCollectionPlanByIds ( ids );
    }

    /**
     * 删除销售订单修改计划信息
     *
     * @param id 销售订单修改计划ID
     * @return 结果
     */
    @Override
    public int deleteSaleCollectionPlanById ( String id ) {
        return saleCollectionPlanMapper.deleteSaleCollectionPlanById ( id );
    }
}
